package com.lagou.service.imp;

import com.lagou.pojo.Article;

import com.lagou.repository.ArticleRepository;
import com.lagou.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleRepository articleRepository;

    @Override
    public Page<Article> queryArticleList(Integer currentPage) {
        Pageable pageable = PageRequest.of(currentPage, 3);
        Page<Article> all = articleRepository.findAll(pageable);
        return all;
    }
}
